package com.fsxgt.datagrid.ds.handler;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import javax.sql.DataSource;

import org.springframework.dao.DataAccessException;

import com.fsxgt.datagrid.ds.bo.ColumnInfo;
import com.fsxgt.datagrid.ds.bo.DatasourceJdbcBO;
import com.fsxgt.datagrid.ds.exception.DsException;

import lombok.Data;




public  interface DbHandler  {
	


	
	public List<ColumnInfo> getColumnNames(String schema,String tableName) throws SQLException ;
	
    public List<String> getTableNames(String schema) throws SQLException;

   
    
	public List<ColumnInfo> getColumnsBySql(String querySql) throws SQLException ;
    
    public Object getMaxIdVal(String tableName, String key, String srcWhere) throws SQLException ;
    
    public String getMaxSqlForExp(String sql, String exp) throws DsException ;
    
    public String getSqlForCount(String sql) throws DsException ;
    
    public int update(String sql,List params) ;
    
    public Object queryForObject(String sql) throws SQLException;
    
    public List<Map<String,Object>> queryForList(String sql,List params) throws SQLException;

	/**  
	 * @Title: getDatasourceType
	 * @Description: TODO(描述)
	 * @return
	 * @author liuyi
	 * @date 2023-12-12 13:29:44 
	 */  
	public String getDatasourceType();

	/**  
	 * @Title: getDatasource
	 * @Description: TODO(描述)
	 * @return
	 * @author liuyi
	 * @date 2023-12-12 13:30:38 
	 */  
	public DataSource getDatasource();

	/**  
	 * @Title: getSchemas
	 * @Description: TODO(描述)
	 * @return
	 * @author liuyi
	 * @throws SQLException 
	 * @date 2023-12-12 13:35:43 
	 */  
	public List<String> getSchemas() throws SQLException;

	/**  
	 * @Title: getConfig
	 * @Description: TODO(描述)
	 * @return
	 * @author liuyi
	 * @date 2023-12-12 14:12:10 
	 */  
	public DatasourceJdbcBO getConfig();
	
	public boolean runTest() throws Exception;
	
	public void close();
    


}
